﻿<Window x:Class="SimpleChat.JoinServerWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        DataContext="{Binding JoinServer, Source={StaticResource Locator}}"
        Title="Join Server" Height="300" Width="400">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="125" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="125" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Button Grid.Column="0" Grid.Row="0" Content="Actualiser" Margin="5" Command="{Binding RefreshCommand}" IsEnabled="{Binding WaitDiscover}" />
        <Button Grid.Column="1" Grid.Row="0" Content="Rejoindre" Margin="5" Click="Button_Click" />

        <TextBlock Grid.Row="1" Grid.Column="0" Text="Username : " HorizontalAlignment="Right" VerticalAlignment="Center" />
        <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Username, Mode=TwoWay}" />

        <TextBlock Grid.Row="1" Grid.Column="2" Text="Password : " HorizontalAlignment="Right" VerticalAlignment="Center" />
        <TextBox Grid.Row="1" Grid.Column="3" Text="{Binding Password, Mode=TwoWay}" />


        <ListView Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="4" ItemsSource="{Binding DiscoveredServices}" SelectedItem="{Binding SelectedService, Mode=TwoWay}">
            <ListView.View>
                <GridView>
                    <GridViewColumn Header="Nom" 
                                    DisplayMemberBinding="{Binding Path=ServiceName}" 
                                    Width="100" />
                    <GridViewColumn Header="IP" 
                                    DisplayMemberBinding="{Binding Path=IP}" 
                                    Width="100" />
                    <GridViewColumn Header="Port" 
                                    DisplayMemberBinding="{Binding Path=TCPPort}" 
                                    Width="100" />
                </GridView>

            </ListView.View>
        </ListView>

    </Grid>
</Window>
